﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Util;
using Android.Views;
using Android.Widget;

namespace RCFlightTimer
{
	public class FlightDescriptionFragment : DialogFragment
	{
		public override Dialog OnCreateDialog (Bundle savedInstanceState)
		{
			base.OnCreateDialog (savedInstanceState);

			LayoutInflater inflater = this.Activity.LayoutInflater;
			View view = inflater.Inflate (Resource.Layout.DescriptionPopup, null);

			var builder = new AlertDialog.Builder (Activity)
				.SetView (view)
				.SetPositiveButton("Ok", (sender, args) =>
					{
						var myActivity =(MainActivity)this.Activity;
						myActivity.setFlightDescription(view.FindViewById<TextView>(Resource.Id.text).Text);
						myActivity.saveFlight();
					})

				.SetNegativeButton("Cancel", (sender, args) =>
					{
						// Do something when this button is clicked.
					})
				.SetTitle("Enter a description of the flight");
			return builder.Create();
		}
	}
}

